{% extends "cms/Base.html" %}

{% block title %}
    <title>前台用户</title>
{% endblock %}

{% block head %}
    <script src="../../static/cms/js/front_user.js"></script>
{% endblock %}

{% block body %}
    <div class="container-fluid col-8 center">
        <table class="table">
          <thead>
            <tr>
              <th scope="col">序号</th>
              <th scope="col">用户名</th>
              <th scope="col">注册日期</th>
              <th scope="col">邮箱</th>
              <th scope="col">操作</th>
            </tr>
          </thead>
          <tbody>
            {% for user in users %}
            <tr>
              <th scope="row">{{ loop.index }}</th>
              <td>{{ user.username }}</td>
              <td>{{ user.join_time }}</td>
              <td>{{ user.email }}</td>
              <td>
                  {% if user.is_active %}
                      <button type="button" class="btn btn-danger btn-active" data-user-id="{{user.id}}" data-is_active="1">冻结</button>
                  {% else %}
                      <button type="button" class="btn btn-success btn-active" data-user-id="{{user.id}}" data-is_active="0">激活</button>
                  {% endif %}
              </td>
            </tr>
            {% endfor %}
          </tbody>
        </table>
    </div>
{% endblock %}